﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NLog;

namespace FileSharingHosting
{
    public partial class Activate : System.Web.UI.Page
    {
        static readonly Logger _log = LogManager.GetCurrentClassLogger();

        protected void Page_Load(object sender, EventArgs e)
        {
            _log.Debug("Account activation page requested.");
            if (Request.RequestType == "GET")
            {
                if (Request.Params["key"] != null)
                {
                    string key = Request.Params["key"];
                    _log.Debug(string.Format("(Key={0})", key));
                    var ubll = new Business.UsersBusinessLogic();
                    if (ubll.ActivateAccount(key) != -1)
                    {
                        _log.Debug("Account activated!");
                        Label1.Visible = true;
                    }
                    else
                    {
                        _log.Info("Failed account activation!");
                        Label2.Visible = true;
                    }
                }
            }
        }
    }
}